<?php
class User extends CI_Controller {
	public function __construct() {
		parent::__construct();
		$this->load->model('user_model');
	}

	public function index() {
		return $this->view();
	}

	public function create() {
		$userData['username'] = $this->input->post('usernamer');
		$userData['password'] = $this->input->post('passwordr');
		$passconf = $this->input->post('passconfr');
		$userData['name'] = $this->input->post('namer');
		if ($passconf != $userData['password']) {
			return $this->register('密码输入不一致!');
		}
		$this->user_model->create($userData);
	}

	public function register($error = FALSE) {
		$data['error'] = '&nbsp;';
		if ($error) {
			$data['error'] = $error;
		}
		$this->load->view('templates/header', $data);
		$this->load->view('user/create');
		$this->load->view('templates/footer');
	}
}